<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<%@ taglib prefix ="s" uri="/struts-tags" %>
<head profile="http://gmpg.org/xfn/11">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><s:property value="%{getText('pokerface.message.main_title')}"></s:property></title>
	<link rel="stylesheet" type="text/css" href="theme/style.css" media="screen" />
	<link rel="stylesheet" href="theme/jquery-ui-1.8.9.custom.css" type="text/css" media="all" />
	<link href="theme/img/favicon.png" type="image/png" rel="icon"/>
	
	<!-- 
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
	<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
	-->

	<script src="theme/js/jquery-1.4.2.min.js" type="text/javascript"></script>
	<script src="theme/js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
	<script src="theme/js/all.js" type="text/javascript"></script>

	<sx:head/>
</head>

<body>
<div id="fb-root"></div>
<script type="text/javascript">
   window.fbAsyncInit = function() {
        FB.init({appId: '148942368491408', status: true, cookie: true, xfbml: true});

        FB.Event.subscribe('auth.login', function(response) {
	        /*
            rpoker.onFacebookLogin(response.session);
            rpoker.Model.idUser = session.uid;
            rpoker.Model.auth_token = session.auth_token;*/
            
            jQnotice('Nous vous connectons ...');

            // register user
               FB.api('/me', function(response) {
                   response.profile_pic = "http://graph.facebook.com/" + response.id + "/picture";
                   
                      if(idUser == undefined || firstName == undefined || lastName == undefined) return;
                      if(this._userServiceLoading) return;

                      this._userServiceLoading = true;
                      var me = this;

                      $.ajax({
                          url: rpoker.ServiceNamer.getUserServiceUrl(idUser, firstName, lastName),
                          dataType: "json",
                          success: function(result) {
                             me._userServiceFinishLoading(result);
                          }
                      });
                                  
                   rpoker.ViewManager.loadProfile(response);
                   rpoker.ViewManager.loadProfileInGame(response);
               });
                   
        });
        
        FB.Event.subscribe('auth.logout', function(response) {
            console.log("Logout facebook");
        });

        FB.getLoginStatus(function(response) {
            console.log(response);
            if (response.session) {
                jQnotice('Compte Facebook détecté, nous vous connectons');
                $.post('connect_facebook', {fid:response.session.uid}, function(d)
              		{
					alert('ok');
              		});
            }
        });
    };
    (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
            '//connect.facebook.net/fr_FR/all.js';
        document.getElementById('fb-root').appendChild(e);
    }());
</script>
	
<s:url action="home" id="langueFr">
	<s:param name="request_locale">fr</s:param>
</s:url>

<s:url action="home" id="langueEn">
	<s:param name="request_locale">en</s:param>
</s:url>

	<div id="header">
		<div class="wrap">
			<img src="theme/img/main-logo-4.png" class="logo" alt="Poker Face" />
			
			<nav class="primary">
			<ul id="topnav">
				<li><a href="home"><s:property value="%{getText('pokerface.menu.accueil')}"></s:property></a></li>
				<li><a href="informations"><s:property value="%{getText('pokerface.menu.informations')}"></s:property></a></li>
				<s:if test="%{#session.allowAccess}">
	                <li><a href="account"><s:property value="%{getText('pokerface.menu.compte')}"></s:property></a></li>
           		</s:if>
			</ul>
			</nav>
		</div>
	</div> 